leftMouseDown = false;
lastX = -1;
lastY = -1;

function mouseWheelCanv(e)
{
	if(e.wheelDelta > 0)
	{
		viewHalfWidth *=1.1;
		viewHalfHeight *=1.1;
	}
	else if(e.wheelDelta < 0)
	{
		viewHalfWidth /=1.1;
		viewHalfHeight /=1.1;
	}
	
	draw();
}


function mouseDownCanv(e)
{
	leftMouseDown = true;
}

function mouseUpCanv(e)
{
	leftMouseDown = false;
	lastX = -1;
	lastY = -1;
}

function mouseMoveCanv(e)
{
	if(leftMouseDown)
	{
		if(lastX != -1)
		{
			centerX += (-e.offsetX + lastX)/(canvWidth) * (viewHalfWidth * 2);
			centerY += (-e.offsetY + lastY)/(canvHeight) * (viewHalfHeight * 2);
			
			draw();			
		}
		
		lastX = e.offsetX;
		lastY = e.offsetY;		
	}
}

